package com.szxy.controller.system;

import com.szxy.dto.OperLogDto;
import com.szxy.service.OperLogService;
import com.szxy.vo.AjaxResult;
import com.szxy.vo.DataGridView;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: zwz
 * @Date:2020/11/17 21:41
 * @Description:
 **/
@RestController
@RequestMapping("/system/operLog")
@Slf4j
public class OperLogController {

    @Autowired
    private OperLogService operLogService;

    /*** 分页查询 */
    @GetMapping("listForPage")
    public AjaxResult listForPage(OperLogDto operLogDto) {
        DataGridView gridView = operLogService.listForPage(operLogDto);
        return AjaxResult.success("查询成功", gridView.getData(), gridView.getTotal());
    }

    /*** 删除 */
    @DeleteMapping("deleteOperLogByIds/{infoIds}")
    public AjaxResult deleteOperLogByIds(@PathVariable Long[] infoIds) {
        return AjaxResult.toAjax(this.operLogService.deleteOperLogByIds(infoIds));
    }

    /*** 清空删除 */
    @DeleteMapping("clearAllOperLog")
    public AjaxResult clearAllOperLog() {
        return AjaxResult.toAjax(this.operLogService.clearAllOperLog());
    }

}
